﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace WebDauGia
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(null, "",
                new { controller = "SanPham",action="List",
                    loaisp=(string)null,page=1});
            routes.MapRoute(null,"Page{page}",
                new{controller = "SanPham",action="List", loaisp=(string)null},
                new{page=@"\d+"}

                );
            routes.MapRoute(null,
                "{loaisp}",
                new{controller="SanPham",action="List",page=1}
                );
            routes.MapRoute(null,
                "{loaisp}/Page{page}",
                new{controller="SanPham",action="List"},
                new{page=@"\d+"}
                );
            routes.MapRoute(null,"{controller}/{action}");

            /*routes.MapRoute(
                name: null,
                url: "Page{page}",
                defaults: new { Controller = "SanPham", action="List" }
            );*/
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "SanPham", action = "DSSanPhamTheoLoai", id = UrlParameter.Optional }
            );
            routes.MapRoute(null,"",
                new{controller="NhanVien",action="Index"}
            );
        }
    }
}